JsArray

interface JsArray : JsObject

A JavaScript array.

An array object can be passed between Java and JavaScript as a method argument or a return value. The object lifetime is bound to the lifetime of the frame this object belongs to. When the owner frame is unloaded, all the JavaScript objects are automatically disposed.

An attempt to access a disposed JavaScript object will result in IllegalStateException.

Since

7.20

Functions

Link copied to clipboard
abstract fun <T> call(methodName: String, args: Array<Any>): T
Executes the function with the given methodName and the args in the JavaScript object.
Link copied to clipboard
abstract fun close()
Closes this JavaScript object.
Link copied to clipboard
abstract fun frame(): Frame
Returns the Frame instance of this JavaScript object.
Link copied to clipboard
@Nullable
abstract fun <T> get(index: Long): T
Returns the element by the specified index.
Link copied to clipboard
abstract fun hasProperty(name: String): Boolean
Checks whether this JavaScript object or any of its prototypes has an enumerable property with the given name.
Link copied to clipboard
abstract fun length(): Long
Returns the number of elements in this array.
Link copied to clipboard
abstract fun ownPropertyNames(): List<String>
Returns an immutable list of the names of the properties of this JavaScript object, both enumerable and non-enumerable, excluding the properties from the prototype objects.
Link copied to clipboard
abstract fun <T> property(name: String): Optional<T>
Returns an Optional describing the value of the JavaScript object's property with the given name or an empty Optional if there is no such property or its value is undefined.
Link copied to clipboard
abstract fun propertyNames(): List<String>
Returns an immutable list of the names of the enumerable properties of this JavaScript object, including the properties from the prototype objects.
Link copied to clipboard
abstract fun putProperty(name: String, @Nullable value: Any): Boolean
Creates a new property with the given name or updates the existing one in the current JavaScript object and returns true if the property with the given name was created or updated successfully.
Link copied to clipboard
abstract fun removeProperty(name: String): Boolean
Removes a property with the given name in the JavaScript object and returns true if the property was successfully removed.
Link copied to clipboard
abstract fun set(index: Long, @Nullable element: Any): Boolean
Inserts the specified element into the array at the specified index.
Link copied to clipboard
abstract fun toList(): List<Any>
Converts this array to a List.
abstract fun <T> toList(type: Class<T>): List<T>
Converts this array to a List with the elements of the specified type.